#include "asm.h"
#include "regdef.h"
#include "inst_test.h"

LEAF(n32_mul_w_test)
    
    addi.w s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_MUL_W(0x45b90738, 0xd70d64f0, 0x0a20a480)
    TEST_MUL_W(0x99a451b0, 0xbe3d9998, 0x8552b080)
    TEST_MUL_W(0x85931c58, 0xfb710fb5, 0xda843238)
    TEST_MUL_W(0x650e4043, 0x64c17218, 0x7076dc48)
    TEST_MUL_W(0xa00c6c50, 0x8e9df080, 0x78d12800)
    TEST_MUL_W(0x99c874b6, 0xd7ce83e0, 0xe7934140)
    TEST_MUL_W(0x1c62f360, 0x34580400, 0xb4cd8000)
    TEST_MUL_W(0x99b80b00, 0x6c463000, 0x84100000)
    TEST_MUL_W(0xdc823390, 0x5208f838, 0x1aeec780)
    TEST_MUL_W(0xe53080d8, 0x848a9c5a, 0xf600ebf0)
    TEST_MUL_W(0x7f2163d8, 0xab5bba80, 0x9904dc00)
    TEST_MUL_W(0xea7b88c0, 0x23eed510, 0xd3004c00)
    TEST_MUL_W(0x7389b4fd, 0xea063940, 0x0ba79440)
    TEST_MUL_W(0xbcdf9b20, 0xc1451978, 0x4e96d700)
    TEST_MUL_W(0xdcacfd50, 0x809d0a80, 0x7273c800)
    TEST_MUL_W(0x55ed3100, 0xbe5ba9f2, 0x3a915200)
    TEST_MUL_W(0xcedb5fd8, 0xe1793b60, 0x4672b900)
    TEST_MUL_W(0x9d32f1b0, 0xbb2016b8, 0x2362d680)
    TEST_MUL_W(0x7091ae43, 0xdb390460, 0x9b456520)
    TEST_MUL_W(0x549bf440, 0xd1dc9f40, 0x2ab0d000)
    TEST_MUL_W(0x63b241cc, 0x48aefe14, 0xbfdd8bf0)
    TEST_MUL_W(0x4c925040, 0x0855d2c8, 0x7d633200)
    TEST_MUL_W(0xdb2dfd2c, 0x6c0e9f09, 0xad443a8c)
    TEST_MUL_W(0xdfdc9250, 0xbf1f15c3, 0x04b402f0)
    TEST_MUL_W(0x1b339b35, 0x98c14bc0, 0x0021eec0)
    TEST_MUL_W(0xc8618b98, 0x69452a40, 0x1141d600)
    TEST_MUL_W(0x2aea0580, 0x7f50d684, 0xf943d600)
    TEST_MUL_W(0x5c69f5ec, 0x9ee23bd2, 0xfcf11f98)
    TEST_MUL_W(0xb7b66b40, 0x8b50c179, 0xa013f140)
    TEST_MUL_W(0x514e33b6, 0x7dc39988, 0x30153eb0)
    TEST_MUL_W(0x27c24e12, 0xbc0e6874, 0x70beb028)
    TEST_MUL_W(0xe7e6eddc, 0x13a7cad0, 0x21d4dac0)
    TEST_MUL_W(0xa85111c0, 0xa29d50f0, 0x844ca400)
    TEST_MUL_W(0x73d52eb8, 0x142ba310, 0x32fa1380)
    TEST_MUL_W(0x41156884, 0x794c5fb2, 0x9ddba7c8)
    TEST_MUL_W(0xa8774820, 0xb2cf0480, 0xaaa49000)
    TEST_MUL_W(0xb69bcb80, 0x88d55520, 0xdf8af000)
    TEST_MUL_W(0xe84175d8, 0x94048f1c, 0xaf5c8ba0)
    TEST_MUL_W(0x6fdedbd8, 0x67dd7f60, 0x341a9900)
    TEST_MUL_W(0xa2319526, 0xd5f88700, 0x40770a00)
    TEST_MUL_W(0x61f8b9bc, 0x146e6d38, 0xd445ad20)
    TEST_MUL_W(0xb9002828, 0x0310a1b9, 0xc4de2ce8)
    TEST_MUL_W(0xb4418f47, 0x943f129c, 0xc27f4d44)
    TEST_MUL_W(0xd7011f8c, 0x70d8ea80, 0x6585be00)
    TEST_MUL_W(0x058b9998, 0x55395538, 0x3b611140)
    TEST_MUL_W(0xc13b7fc0, 0xda192fbb, 0x0caa9140)
    TEST_MUL_W(0x776d24b0, 0x66f0a9a4, 0x1423b0c0)
    TEST_MUL_W(0x6c6ae338, 0x5c4abc80, 0x827ebc00)
    TEST_MUL_W(0x9dc090e0, 0xb6324980, 0x55585000)
    TEST_MUL_W(0x86d609de, 0xcd4bcb2e, 0x9e52cfe4)
    TEST_MUL_W(0x1400c7dc, 0x466a6d5e, 0x967a0ec8)
    TEST_MUL_W(0xa2d88860, 0x26423686, 0x52dba240)
    TEST_MUL_W(0x6770770a, 0x812cbe10, 0x6f18dca0)
    TEST_MUL_W(0x95627048, 0xc1bae8ca, 0xf1bdd8d0)
    TEST_MUL_W(0x1dbadda0, 0x5d2b0f50, 0x9741a200)
    TEST_MUL_W(0xc7cf4f96, 0x7dd33820, 0x29f4c2c0)
    TEST_MUL_W(0xa1d8f960, 0xb83e3183, 0xbf02fc20)
    TEST_MUL_W(0xcc2c955e, 0x63c2877e, 0x8bf21644)
    TEST_MUL_W(0xd2d44530, 0x602b39e6, 0x4d2dd920)
    TEST_MUL_W(0x886c3ad7, 0xe011a4c0, 0xaf24dd40)
    TEST_MUL_W(0x0c45d0c8, 0x830e02fb, 0x57054418)
    TEST_MUL_W(0x49979c44, 0x298742f0, 0x604807c0)
    TEST_MUL_W(0x2037c800, 0xfb355f34, 0xa68ca000)
    TEST_MUL_W(0x21e68aeb, 0xc1cc4ec0, 0x897fca40)
    TEST_MUL_W(0xe2c488b8, 0x8ed6a9d8, 0x6de4d340)
    TEST_MUL_W(0x0622c000, 0x849e669e, 0x21f28000)
    TEST_MUL_W(0xfe11325e, 0x5a980480, 0x4132a700)
    TEST_MUL_W(0xb582a660, 0x27161c30, 0x3ef1b200)
    TEST_MUL_W(0xde436ee0, 0x0b8fd2ea, 0x09b718c0)
    TEST_MUL_W(0x3ca5ebcc, 0x7fca89b0, 0xc03a4840)
    TEST_MUL_W(0xed8ac2a2, 0x8e11d628, 0xe523d550)
    TEST_MUL_W(0xee62ac9c, 0x446aed90, 0x59e583c0)
    TEST_MUL_W(0xa5a41fa0, 0x901ecf7a, 0x5a897240)
    TEST_MUL_W(0x1665a95c, 0x01fa0f1c, 0x27e2ea10)
    TEST_MUL_W(0xf760c288, 0x024d9a70, 0x0242eb80)
    TEST_MUL_W(0xb91b1700, 0xff6a7770, 0x198b1000)
    TEST_MUL_W(0x38a15d4c, 0x4d378f48, 0xf7d3b160)
    TEST_MUL_W(0xe1d0a988, 0x29062820, 0x95c27100)
    TEST_MUL_W(0xb657c3ec, 0x42373c21, 0x02ef916c)
    TEST_MUL_W(0x8cd72e00, 0x0657e392, 0xc2823c00)
    TEST_MUL_W(0xcffca4a4, 0xf52aba30, 0x85e606c0)
    TEST_MUL_W(0xd823b826, 0xed601012, 0xaa4552ac)
    TEST_MUL_W(0x306f7f24, 0x6384a554, 0x3c17ebd0)
    TEST_MUL_W(0x0c59e770, 0x3e387808, 0x47cbbb80)
    TEST_MUL_W(0xc1dd451c, 0xe125f520, 0x97d86f80)
    TEST_MUL_W(0xef4e68d4, 0x9ff2ad9b, 0xa5b8bc5c)
    TEST_MUL_W(0x7ef6ec24, 0xb177da10, 0xdd416a40)
    TEST_MUL_W(0x6fb25f72, 0x791ebb10, 0x583a3d20)
    TEST_MUL_W(0x58101600, 0xd3840640, 0xbc898000)
    TEST_MUL_W(0x07affc60, 0x5ea8d5b0, 0x94f96200)
    TEST_MUL_W(0xf952c740, 0x73978b1c, 0x7dfd8b00)
    TEST_MUL_W(0x8f689828, 0x91565574, 0x7b5a3a20)
    TEST_MUL_W(0x914d8000, 0xba3b44b8, 0x85b40000)
    TEST_MUL_W(0x4d2e3cf5, 0x70e9d5e8, 0x159c1708)
    TEST_MUL_W(0xb037ad58, 0x11952040, 0xbfce5600)
    TEST_MUL_W(0xa4246038, 0x111ad568, 0x7085aec0)
    TEST_MUL_W(0xef964a3a, 0xd18d5d08, 0x519b63d0)
    TEST_MUL_W(0xa4a7728e, 0x97843fdc, 0x884f6408)
    TEST_MUL_W(0xdf30b100, 0x250933f8, 0x236e7800)
    TEST_MUL_W(0x1d5818a4, 0xe5093304, 0x940d0e90)
    TEST_MUL_W(0x15122298, 0xcbbb9870, 0xc9816280)
    TEST_MUL_W(0x88ca117e, 0x0e125f90, 0x0d0398e0)
    TEST_MUL_W(0xdf4ef397, 0xda63b6b6, 0xacb3875a)
    TEST_MUL_W(0x6683ae60, 0x63fc1988, 0x187c0300)
    TEST_MUL_W(0xe6a56cae, 0xd0003efb, 0x9483b29a)
    TEST_MUL_W(0x7d58aade, 0x5b2167ac, 0xd4f01f28)
    TEST_MUL_W(0x61118bd0, 0x9e016e14, 0x0b424c40)
    TEST_MUL_W(0x7fdd22be, 0xfdcc9fee, 0xad924ea4)
    TEST_MUL_W(0x70e273a0, 0xd87fc19c, 0xdf8a1580)
    TEST_MUL_W(0x3940dad6, 0xa37c292b, 0x429907f2)
    TEST_MUL_W(0xba7ab435, 0x2322d7d0, 0xbf14ee10)
    TEST_MUL_W(0x0b238760, 0x2bff2a02, 0xe31ccec0)
    TEST_MUL_W(0xaa6a9390, 0x8d3ab108, 0xc1fb2c80)
    TEST_MUL_W(0xe3667224, 0xbf514d80, 0x7cf1e600)
    TEST_MUL_W(0x53b1b42e, 0x7c608578, 0x67285b90)
    TEST_MUL_W(0x8241ddf4, 0x4a8d0e90, 0xa6943140)
    TEST_MUL_W(0x7cdcd5cf, 0xe584065f, 0xecb231d1)
    TEST_MUL_W(0x50445224, 0xb34e8c5c, 0x687134f0)
    TEST_MUL_W(0x436d75a7, 0x2cb9b728, 0x81e3c318)
    TEST_MUL_W(0xdb906f30, 0x0eafa7d0, 0x3fb2a700)
    TEST_MUL_W(0x5aa5b57e, 0xeb138c80, 0x1475a700)
    TEST_MUL_W(0xbc61fc9c, 0x2c0b0f78, 0xb66f8d20)
    TEST_MUL_W(0x8b3566b7, 0x2b021ecc, 0xbb054bd4)
    TEST_MUL_W(0x666e54e8, 0xed91452c, 0x37411fe0)
    TEST_MUL_W(0xc6e59380, 0xfa935180, 0xc8f54000)
    TEST_MUL_W(0xd921e0b0, 0x1f7d65c0, 0x3cfdf400)
    TEST_MUL_W(0x7b8db2e2, 0x84d37b50, 0xa9807ca0)
    TEST_MUL_W(0xf89e1b58, 0x26be32a0, 0x9f784700)
    TEST_MUL_W(0x524aa0a6, 0x0b334594, 0xd3839df8)
    TEST_MUL_W(0xa3be10e8, 0x18dbc860, 0x1af39700)
    TEST_MUL_W(0x073cf5be, 0x4fbf4882, 0xccd43a7c)
    TEST_MUL_W(0x91db7100, 0x1f78ebb0, 0xaf98b000)
    TEST_MUL_W(0xc49e36d8, 0x2044fa90, 0xabedc980)
    TEST_MUL_W(0xaf4ab2b8, 0xf0086f40, 0x4bea7600)
    TEST_MUL_W(0xc72f0de2, 0x407a26e0, 0x62efb1c0)
    TEST_MUL_W(0x95d26876, 0x9aaece1c, 0xaf4660e8)
    TEST_MUL_W(0x72e2ec10, 0xb9098e00, 0xbb80e000)
    TEST_MUL_W(0xdeb27a9c, 0x506c0849, 0x8e89d67c)
    TEST_MUL_W(0x530194f0, 0x00000000, 0x00000000)
    TEST_MUL_W(0x5a1a4f60, 0x00000000, 0x00000000)
    TEST_MUL_W(0x5cc4e136, 0x00000000, 0x00000000)
    TEST_MUL_W(0xab7a14c0, 0x00000000, 0x00000000)
    TEST_MUL_W(0x44d126d0, 0x00000000, 0x00000000)
    TEST_MUL_W(0x0f114ff0, 0x00000000, 0x00000000)
    TEST_MUL_W(0x60bfe48e, 0x00000000, 0x00000000)
    TEST_MUL_W(0x102ceba0, 0x00000000, 0x00000000)
    TEST_MUL_W(0x7b21e54d, 0x00000000, 0x00000000)
    TEST_MUL_W(0x5d72f954, 0x00000000, 0x00000000)
    TEST_MUL_W(0x2699b2d4, 0x00000000, 0x00000000)
    TEST_MUL_W(0x66b6dc30, 0x00000000, 0x00000000)
    TEST_MUL_W(0x00000000, 0x4ae569a0, 0x00000000)
    TEST_MUL_W(0x00000000, 0x2582c9c0, 0x00000000)
    TEST_MUL_W(0x00000000, 0xa2f01d2e, 0x00000000)
    TEST_MUL_W(0x00000000, 0x2c5300d7, 0x00000000)
    TEST_MUL_W(0x00000000, 0x7a95fab0, 0x00000000)
    TEST_MUL_W(0x00000000, 0xf415d1b4, 0x00000000)
    TEST_MUL_W(0x00000000, 0x0caf7d5c, 0x00000000)
    TEST_MUL_W(0x00000000, 0xae15e524, 0x00000000)
    TEST_MUL_W(0x00000000, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addi.w s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    slli.w t1, s0, 24
    NOP4
    or t0, t1, s3 
    NOP4
    st.w t0, s1, 0
    jirl zero, ra, 0
END(n32_mul_w_test)
